package com.jk.controller;

import com.jk.bean.Author;
import com.jk.bean.Page;
import com.jk.bean.PingLun;
import com.jk.bean.SendPage;
import com.jk.service.CommentService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

@Controller
@RequestMapping("pl")
public class CommentController {
    @Resource
    private CommentService commentService;

    @ResponseBody
    @RequestMapping("getPingLun")
    public SendPage getPingLun(Page pag, PingLun pl){
        SendPage sd = commentService.getPingLun(pag,pl);
       return sd;
    }

     @ResponseBody
     @RequestMapping("delPingLun")
     public String delPingLun(String id){
         commentService.delPingLun(id);
         return null;
     }

     //=====修
    @ResponseBody
    @RequestMapping("updaPingLun")
     public PingLun updaPingLun(String id){

        return  commentService.updaPingLun(id);
    }
    //=====新增
    @ResponseBody
    @RequestMapping("addPingLun")
    public String addPingLun(PingLun p){
       commentService.addPingLun(p);
        return null;
    }

  //====作者
    @ResponseBody
    @RequestMapping("getAuthor")
    public List<Author> getAuthor(){

        return commentService.getAuthor();
    }



}
